﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace _80X_CG_Frame.Objects
{
    /// <summary>
    /// 产品
    /// </summary>
    public class Product: INotifyPropertyChanged
    {
        string barcode;
        ProductStatus status;
        JObject jobj;
        int ng;

        public Product()
        {
            Barcode = "";
            ng = 0;
        }
        /// <summary>
        /// 过站报告
        /// </summary>
        public JObject Report { get => jobj; set => jobj = value; }
        public int 屏蔽片焊接失败 { get => ng; set => ng = value; }
        public ProductStatus Status { get => status; set => status = value; }
        public string Barcode
        {
            get => barcode; set
            {
                barcode = value;
                NotifyPropertyChanged();
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        // This method is called by the Set accessor of each property.
        // The CallerMemberName attribute that is applied to the optional propertyName
        // parameter causes the property name of the caller to be substituted as an argument.
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
    /// <summary>
    /// 产品状态
    /// </summary>
    public enum ProductStatus
    {
        /// <summary>
        /// 未焊接
        /// </summary>
        Raw,
        /// <summary>
        /// 好的
        /// </summary>
        OK,
        /// <summary>
        /// 坏的
        /// </summary>
        NG
    }
}
